package com.spring.autowired.example;

import com.spring.autowired.example.pojo.Person;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class testPojo {
    @Test
    public void testPerson1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("beans1.xml");
        Person person = context.getBean("person", Person.class);
        person.getDog().shout();
        person.getCat().shout();
    }

    //使用注解实现自动装配
    @Test
    public void testPerson2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("beans2.xml");
        Person person = context.getBean("person", Person.class);
        person.getDog().shout();
        person.getCat().shout();
    }
}
